package Thread;

public class Dome1{
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(()->{
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("启动线程1");
        });
        Thread t2 = new Thread(()->{
            try{
                Thread.sleep(1000);
            }catch(InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("启动线程2");
        });
        Thread t3 = new Thread(()->{
            try{
                Thread.sleep(1000);
            }catch (InterruptedException e) {
                e.printStackTrace();
            }
            try {
                //线程3等待t1执行
                t1.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("启动线程3");
        });
        t1.start();
        t2.start();
        t3.start();
        //main线程等待t1线程执行
        t1.join();
        System.out.println("main线程启动");
    }
}
